package net.xumf.support.enums;

import lombok.Getter;
import net.xumf.support.exception.NotFoundEnumInfoException;

import java.util.Arrays;

@Getter
public enum ReportJiraRelationType {

    OR(0, "or"),
    AND(1, "and"),;

    ReportJiraRelationType(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    private int code;
    private String msg;

    public static ReportJiraRelationType getByCode(int code) {
        return Arrays.stream(values()).filter(o -> o.code == code).findAny()
                .orElseThrow(() -> new NotFoundEnumInfoException(CodeEnum.ENUM_NOT_FOUND_ERROR));
    }
}
